package com.cwj.film.controller;

import com.cwj.common.utils.HttpRequest;
import com.cwj.common.vo.Result;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.ServletContext;

@RestController
public class UrlController {
    @Resource
    private ServletContext servletContext;
    @Resource
    private StringRedisTemplate stringRedisTemplate;
    @PostMapping("/GetFilmUrl")
    private Result GetFilmUrl(){
        Object filmUrl = servletContext.getAttribute("FilmUrl");
        return Result.normal(filmUrl,"film模块的url");
    }
    @PostMapping("/GetUserUrl")
    private Result GetUserUrl(){
        String UserUrl=stringRedisTemplate.opsForValue().get("UserUrl");
        System.out.println("请求用户模块地址  "+UserUrl);
        return Result.normal(UserUrl,null);
    }
}
